import { PORT3 } from "@/api/config/servicePort";
import { Article } from "@/api/interface/index";
import http from "@/api";

// 获取文章列表
export const getArticleApi = (params: any) => {
  return http.post(PORT3 + `/blog/list`, params);
};

// 删除文章
export const delArticleApi = (params: any) => {
  return http.post(PORT3 + `/blog/del`, params);
};

// 获取标签列表(不分页)
export const getTagApi = () => {
  return http.post<Article.ResTagList>(PORT3 + `/tag`);
};

// 获取标签列表(分页)
export const getTagListApi = (params: any) => {
  return http.post<Article.ResTagList>(PORT3 + `/tag/list`, params);
};

// 新增标签
export const addTagApi = (params: any) => {
  return http.post(PORT3 + `/tag/add`, params);
};

// 编辑标签
export const updateTagApi = (params: any) => {
  return http.post(PORT3 + `/tag/update`, params);
};

// 编辑标签
export const delTagApi = (params: any) => {
  return http.post(PORT3 + `/tag/del`, params);
};

// 新增博客
export const addBlogApi = (params: any) => {
  return http.post(PORT3 + `/blog/add`, params);
};

// 更新博客
export const updateBlogApi = (params: any) => {
  return http.post(PORT3 + `/blog/update`, params);
};

// 启用和禁用博客
export const updateBlogStatus = (params: any) => {
  return http.post(PORT3 + `/blog/update_status`, params);
};

// 更新排序
export const updateBlogSort = (params: any) => {
  return http.post(PORT3 + `/blog/update_sort`, params);
};

// 查询博客详情
export const detailBlogApi = (params: any) => {
  return http.post(PORT3 + `/blog/detail`, params);
};

// 标签列表
export const tagListApi = (params: any) => {
  return http.post(PORT3 + `/tag/index`, params);
};
